ensure_drag_cursor_pixbuf (i);
cursor_surface = gdk_cairo_surface_create_from_pixbuf (drag_cursors[i].pixbuf, 1, NULL);
}
- else
- {
-#if 0
- /* The code below is an attempt to let cursor themes
- * determine the attachment of the icon to enable things
- * like the following:
- *
- * +-----+
- * | |
- * | ||
- * +-----+|
- * ---+
- *
- * It does not work since Xcursor doesn't allow to attach
- * any additional information to cursors in a retrievable
- * way (there are comments, but no way to get at them
- * short of searching for the actual cursor file).
- * If this code ever gets used, the icon_window placement
- * must be changed to recognize these placement options
- * as well. Note that this code ignores info->hot_x/y.
- */
- for (j = 0; j < 10; j++)
- {
- const gchar *opt;
- gchar key[32];
- gchar **toks;
- GtkAnchorType icon_anchor;
-
- g_snprintf (key, 32, "comment%d", j);
- opt = gdk_pixbuf_get_option (cursor_pixbuf, key);
- if (opt && g_str_has_prefix ("icon-attach:", opt))
- {
- toks = g_strsplit (opt + strlen ("icon-attach:"), "'", -1);
- if (g_strv_length (toks) != 3)
- {
- g_strfreev (toks);
- break;
- }
- icon_anchor = atoi (toks[0]);
- icon_x = atoi (toks[1]);
- icon_y = atoi (toks[2]);
-
- switch (icon_anchor)
- {
- case GTK_ANCHOR_NORTH:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_SOUTH:
- icon_x += icon_width / 2;
- break;
- case GTK_ANCHOR_NORTH_EAST:
- case GTK_ANCHOR_EAST:
- case GTK_ANCHOR_SOUTH_EAST:
- icon_x += icon_width;
- break;
- default: ;
- }
-
- switch (icon_anchor)
- {
- case GTK_ANCHOR_WEST:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_EAST:
- icon_y += icon_height / 2;
- break;
- case GTK_ANCHOR_SOUTH_WEST:
- case GTK_ANCHOR_SOUTH:
- case GTK_ANCHOR_SOUTH_EAST:
- icon_x += icon_height;
- break;
- default: ;
- }
-
- g_strfreev (toks);
- break;
- }
- }
-#endif
- }
get_surface_size (cursor_surface, &cursor_width, &cursor_height);